/**
*  Copyright 2009-2014 by WWW.KNET.CN  All rights reserved.
*/
package com.domain.service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.domain.mapper.ICloudWebDishMapper;
import com.domain.model.CloudWebDish;

/**
 * TODO(这里用一句话描述这个类的作用)
 * @author liujie
 * @date 2015年4月17日 下午1:25:05
 * 
 */
@Service(value="cloudWebDishService")
public class CloudWebDishService {
	@Resource
	private ICloudWebDishMapper cloudWebDishMapper;
	 public  void add(CloudWebDish obj){
		 obj.setDishWhen(new Date());
		 obj.setIfDelete(0l);
		 cloudWebDishMapper.add(obj);
	 }

	  public  void update(CloudWebDish msg){
		  CloudWebDish obj=cloudWebDishMapper.get(msg.getId());
		  obj.setDishName(msg.getDishName());
		  obj.setDishContent(msg.getDishContent());
		  obj.setPorCode(msg.getPorCode());
		  obj.setDishAccessory(msg.getDishAccessory());
		  obj.setDishAuthor(msg.getDishAuthor());
		  obj.setDishCatagory(msg.getDishCatagory());
		  obj.setDishIfreview(msg.getDishIfreview());
		  obj.setDishUrl(msg.getDishUrl());
		  obj.setDishSource(msg.getDishSource());
		  obj.setDishSecondname(msg.getDishSecondname());
		  obj.setDishSubtitle(msg.getDishSubtitle());
		  cloudWebDishMapper.update(obj);
	  }
	  public  void deleteById(Long paramLong){
		  CloudWebDish obj=cloudWebDishMapper.get(paramLong);
		  obj.setIfDelete(1l);
		  cloudWebDishMapper.update(obj);
	  }


	  public  CloudWebDish get(Long paramLong){
		  return cloudWebDishMapper.get(paramLong);
				  
	  }
	  public  void head(Long id){
		  CloudWebDish obj=cloudWebDishMapper.get(id);
		  if (null != obj) {
			 Long status=obj.getDishStatus();
			 if (null == status || status.equals("") || status.equals(0l)) {
				 obj.setDishStatus(1l);
			 }else {
				obj.setDishStatus(0l);
			}
			cloudWebDishMapper.update(obj);
		}
				  
	  }
	  public  List<CloudWebDish> getList(Map<String, Object> paramMap){
		  return cloudWebDishMapper.getList(paramMap);
	  }

	  public  List<CloudWebDish> getListPage(Map<String, Object> paramMap){
		  return cloudWebDishMapper.getListPage(paramMap);
	  }
	  public  Long getRows(Map<String, Object> paramMap){
		  return cloudWebDishMapper.getRows(paramMap);
	  }

	  public  void updateText(CloudWebDish paramCloudWebMessage){
		  
		  cloudWebDishMapper.update(paramCloudWebMessage);
	  }

	  
}
